/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package specifications;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.nodes.Tag;

/**
 *
 * @author Jason
 */
public class Submissions extends Parameter implements YamlObject<Submissions> {
    public static final Tag TAG = new Tag("!Submissions");
    private ArrayList<Directive> qualifications;
    private ArrayList<Directive> deliverables;
    private ArrayList<Directive> delivery;
    private Date deadline;
    
    public Submissions(){}
    public Submissions(ArrayList<Directive> qualifications,
                       ArrayList<Directive> deliverables,
                       ArrayList<Directive> delivery,
                       Date deadline){
        setPriority(20);
        this.qualifications = qualifications;
        this.deliverables = deliverables;
        this.delivery = delivery;
    }
    
    @Override
    public ArrayList<Directive> getDirectives() {
        ArrayList<Directive> list = new ArrayList<Directive>();
        list.addAll(delivery);
        list.addAll(deliverables);
        list.addAll(qualifications);
        return list;
    }

    @Override
    public void dump(String filename) throws IOException {
        Yaml yaml = new Yaml(CONSTRUCTOR, REPRESENTER);
        FileWriter writer = new FileWriter(filename);
        writer.write(yaml.dumpAs(this, TAG, DumperOptions.FlowStyle.BLOCK));
        writer.close();
    }

    @Override
    public Submissions load(String filename) throws IOException {
        Yaml yaml = new Yaml(CONSTRUCTOR, REPRESENTER);
        FileReader reader = new FileReader(filename);
        Submissions param = yaml.loadAs(reader, Submissions.class);
        reader.close();
        return param;
    }


    /**
     * @return the qualifications
     */
    public ArrayList<Directive> getQualifications() {
        return qualifications;
    }

    /**
     * @param qualifications the qualifications to set
     */
    public void setQualifications(ArrayList<Directive> qualifications) {
        this.qualifications = qualifications;
    }

    /**
     * @return the deliverables
     */
    public ArrayList<Directive> getDeliverables() {
        return deliverables;
    }

    /**
     * @param deliverables the deliverables to set
     */
    public void setDeliverables(ArrayList<Directive> deliverables) {
        this.deliverables = deliverables;
    }

    /**
     * @return the delivery
     */
    public ArrayList<Directive> getDelivery() {
        return delivery;
    }

    /**
     * @param delivery the delivery to set
     */
    public void setDelivery(ArrayList<Directive> delivery) {
        this.delivery = delivery;
    }

    /**
     * @return the deadline
     */
    public Date getDeadline() {
        return deadline;
    }

    /**
     * @param deadline the deadline to set
     */
    public void setDeadline(Date deadline) {
        this.deadline = deadline;
    }


    
}
